﻿using System.Data.Entity;
using System.Linq;
using CH.FourBoards.LagerWalti.Persistence.Entities;

namespace CH.FourBoards.LagerWalti.Persistence.DataAccess.EntityProviders
{
    internal class CategoryProvider : EntityProvider<Category>
    {
        public CategoryProvider(DataContext context)
            : base(context)
        {
        }

        protected override DbSet<Category> Set
        {
            get { return Context.Categories; }
        }

        protected override IQueryable<Category> SetEagerlyLoaded
        {
            get { return Context.Categories.Include(c => c.ParentCategory).Include(c => c.Products); }
        }
    }
}
